From 40207fced97b54cc9c76a9244009e190484e0954 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Sun, 4 Aug 2013 23:01:55 +0000 Subject: [PATCH] fix memory leak in strip_html(). git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4504 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/util.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gpsbabel/util.cc b/gpsbabel/util.cc index 1bc16c2e8..d908e8c91 100644 --- a/gpsbabel/util.cc +++ b/gpsbabel/util.cc @@ -1563,7 +1563,8 @@ strip_html(const utf_string *in) char* outstring, *out; // If toUtf8() is used here, we double encode in the OSM test case. // this may be a bug here or elsewhere. - char* instr = xstrdup(in->utfstring.toLatin1().data()); + char* incopy, *instr; + incopy = instr = xstrdup(in->utfstring.toLatin1().data()); char tag[8]; unsigned short int taglen = 0; @@ -1637,6 +1638,9 @@ strip_html(const utf_string *in) instr++; } *out++ = 0; + if (incopy) { + xfree(incopy); + } return (outstring); } -- 2.30.2